<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:g="http://giava.by/common/base"
	template="/WEB-INF/layout/t.xhtml">

	<ui:define name="title">
		<h:outputText value="Scheda Pubblicazioni" />
	</ui:define>
	<ui:define name="roles">
		<f:attribute name="roles" value="exhibition" />
	</ui:define>
	<ui:define name="content">
		<h:form>
			<center>
				<p:panel header="Scheda Pubblicazioni">

					<h:panelGrid columns="2">
						<h:outputLabel for="author" style="font-weight: bolder;"
							value="Autore: " />
						<h:outputText id="author"
							value="#{publicationController.element.author}" />
						<h:outputLabel for="title" style="font-weight: bolder;"
							value="Titolo: " />
						<h:outputText id="title"
							value="#{publicationController.element.title}" />

						<h:outputLabel for="date" style="font-weight: bolder;"
							value="Data: " />
						<h:outputText id="date"
							value="#{publicationController.element.date}" />

						<h:outputLabel for="exhibition" style="font-weight: bolder;"
							value="Esposizione: " />
						<h:outputText id="exhibition"
							value="#{publicationController.element.exhibition.name}"
							width="640px" />


						<h:outputLabel for="preview" style="font-weight: bolder;"
							value="Anteprima: " />
						<h:outputText id="preview"
							value="#{publicationController.element.preview}" />

						<h:outputLabel for="content" style="font-weight: bolder;"
							value="Contenuto: " />
						<h:outputText id="content"
							value="#{publicationController.element.content}" escape="false" />

						<h:outputLabel for="link" style="font-weight: bolder;"
							value="Link: " />
						<h:outputText id="link"
							value="#{publicationController.element.link}" escape="false" />
					</h:panelGrid>

					<br />
					<h2>Documenti</h2>


					<p:dataTable var="doc" rowIndexVar="rowIndex"
						value="#{publicationController.element.documents}">
						<p:column>
							<f:facet name="header">num</f:facet>
							<h:outputText value="#{rowIndex+1}" />
						</p:column>

						<p:column>
							<f:facet name="header">scarica documento</f:facet>
							<h:outputLink value="/docs/#{doc.filename}" target="_blank">
								<h:outputText value="#{doc.filename}" />
							</h:outputLink>
						</p:column>
					</p:dataTable>
					<br />

					<h2>Immagini</h2>

					<p:lightBox>
						<ui:repeat var="var"
							value="#{publicationController.element.images}">
							<h:outputLink value="#{request.contextPath}/img/#{var.filename}"
								title="#{var.filename}">
								<h:graphicImage value="/img/#{var.filename}"
									width="#{g:imageWidthProportionalUrl('img/'.concat(r.filename),100,100)}"
									height="#{g:imageHeightProportionalUrl('img/'.concat(r.filename), 100, 100)}"
									alt="#{var.filename}" title="#{var.filename}"
									style="padding: 5px;" />
							</h:outputLink>

						</ui:repeat>
					</p:lightBox>

				</p:panel>
				<br /> <br />
				<h:panelGrid columns="3">
					<h:commandButton action="#{publicationController.modCurrent}"
						value="Modifica Testi" />
					<h:commandButton
						action="#{publicationController.modDocumentsCurrent}"
						value="Modifica Documenti" />
					<h:commandButton id="addElement"
						action="#{publicationController.addElement}" value="Aggiungi" />
				</h:panelGrid>
			</center>
		</h:form>

	</ui:define>
</ui:composition>